package cn.itcast.wushangxiantu.UserData;


public class UserValue {
    private User user;
    private double sm;
    private double fy;
    private double gj;
    private double bj;
    private double hf;
    private double ct;
    private double mz;
    private double sb;

    public UserValue(User user) {
        this.user = user;
        /**
         * 生命
         */
        double num=0;
        int shitou= user.getLs1()+user.getLs2()+user.getLs3()+user.getLs4();
        sm+=shitou*300;
        if (user.getZhuangbei().get(1)!=null){
            num= user.getZhuangbei().get(1).getJsdj()*100+
                    user.getZhuangbei().get(1).getJsdj()*(user.getHj2()/50);
            sm+=num;
            sm+= user.getDj()*100;
        }
        /**
         * 攻击力
         */
        gj+=shitou*80;

        if (user.getZhuangbei().get(0)!=null){

            int number= user.getZhuangbei().get(0).getJsdj();

            num= user.getZhuangbei().get(0).getJsdj()*40+
                    user.getZhuangbei().get(0).getJsdj()*(user.getWq2()/50);
            gj+=num;
            gj+=user.getDj()*10;
        }
        /**
         * 防御
         */
        fy+=shitou*40;
        if (user.getZhuangbei().get(1)!=null){
            num= user.getZhuangbei().get(1).getJsdj()*20+
                    user.getZhuangbei().get(1).getJsdj()*(user.getHj2()/100);
            fy+=num;
        }
        /**
         * 闪避
         */

        if (user.getZhuangbei().get(3)!=null){

            num= user.getZhuangbei().get(3).getJsdj()/5+
                    (user.getZhuangbei().get(3).getJsdj()*(user.getZj2())/1000);
            sb+=num;
        }
        /**
         * 穿透
         */
        ct+=shitou*20;

        if (user.getZhuangbei().get(2)!=null){
            num= user.getZhuangbei().get(2).getJsdj()*10+
                    user.getZhuangbei().get(2).getJsdj()*(user.getJz2()/50);
            ct+=num;
        }
        /**
         * 命中
         */

        if (user.getZhuangbei().get(2)!=null){
            num= user.getZhuangbei().get(2).getJsdj()/5+
                    (user.getZhuangbei().get(2).getJsdj()*(user.getJz2())/1000);
            mz+=num;
        }

        /**
         * 回复
         */
        hf+=shitou*20;

        if (user.getZhuangbei().get(3)!=null){
            num= user.getZhuangbei().get(3).getJsdj()*10+
                    user.getZhuangbei().get(3).getJsdj()*(user.getZj2()/50);
            hf+=num;
        }
        /**
         * 暴击
         */
        if (user.getZhuangbei().get(0)!=null){
            num= user.getZhuangbei().get(0).getJsdj()/5+
                    (user.getZhuangbei().get(0).getJsdj()*user.getWq2()/1000);
            bj+=num;
        }
    }

    public int getSm() {
        return (int)sm;
    }

    public void setSm(int sm) {
        this.sm = sm;
    }

    public int getFy() {
        return (int)fy;
    }

    public void setFy(int fy) {
        this.fy = fy;
    }

    public int getGj() {
        return (int)gj;
    }

    public void setGj(int gj) {
        this.gj = gj;
    }

    public int getBj() {
        if ((int)bj>45){
            return 45;
        }else {
            return (int)bj;
        }
    }

    public void setBj(double bj) {
        this.bj = bj;
    }

    public int getHf() {
        return (int)hf;
    }

    public void setHf(int hf) {
        this.hf = hf;
    }

    public int getCt() {
        return (int)ct;
    }

    public void setCt(int ct) {
        this.ct = ct;
    }

    public int getMz() {
       if ((int)mz>45){
           return 45;
       }else {
           return (int)mz;
       }
    }

    public void setMz(double mz) {
        this.mz = mz;
    }

    public int getSb() {
        if ((int)sb>45){
            return 45;
        }else {
            return (int)sb;
        }
    }

    public void setSb(double sb) {
        this.sb = sb;
    }
}
